package com.zrx.springboot.web;


import com.zrx.springboot.entity.BackOrder;

import com.zrx.springboot.service.BackOrderService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class BackOrderController {
    @Autowired
    private BackOrderService backOrderService;
    private Object BackOrder;

    @GetMapping("/order_table")
    public String mainPage(HttpSession session) {

        return "form/order_table";
    }

    /**
     * 显示订单信息
     */
    @RequestMapping("/getOrderData")
    public String getOrderData(Model model){

        System.out.println("显示订单信息------------");



       List<BackOrder> backOrderList = backOrderService.fianOederList();
        model.addAttribute("orderlist", backOrderList);

        return "form/orderDate";
    }
    /**
     * 模糊订单信息
     */
    @RequestMapping("/getOrderDataName")
    public String getOrderDataName(Model model,String ordername){

        System.out.println("显示订单信息------------");

        System.out.println(ordername);
        ordername= "%" +ordername+"%";


        List<BackOrder> backOrderList = backOrderService.fianOedernameList(ordername);
        model.addAttribute("orderlist", backOrderList);

        return "form/orderDate";
    }


}
